home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / graphics / qpeg11c.zip / DRV.DOC < prev    next >
Text File  |  1993-11-07  |  4KB  |  90 lines

  1.  
  2.    QPEG video driver files
  3.    ~~~~~~~~~~~~~~~~~~~~~~~
  4.  
  5. If you have a video card which is not supported by QPEG (i.e. there is no
  6. *.DRV file for your card), you can write a driver yourself.  You have to
  7. know how the bank switching is done with your card, and you must know
  8. how to program in assembler.
  9.  
  10. First, write a TASM source file named XXXX.ASM (instead of 'XXXX', choose
  11. something descriptive for your VGA card).  It has to look like the
  12. following:
  13.  
  14.    ----------------------------------------------
  15.    |         .286                               |
  16.    | Code    Segment Para 'Code'                |
  17.    |         Assume  cs:Code                    |
  18.    |         Org 100h                           |
  19.    |                                            |
  20.    | Procs   dw      Bank,Init,Exit,0           |
  21.    |                                            |
  22.    | Bank:   ...                                |
  23.    |         ...                                |
  24.    |         retf                               |
  25.    |                                            |
  26.    | Init:   ...                                |
  27.    |         ...                                |
  28.    |         retf                               |
  29.    |                                            |
  30.    | Exit:   ...                                |
  31.    |         ...                                |
  32.    |         retf                               |
  33.    |                                            |
  34.    | Code    Ends                               |
  35.    |         End Procs                          |
  36.    ----------------------------------------------
  37.  
  38. If you want to use 386 instructions, don't forget to add USE16 to the
  39. Segment statement.
  40.  
  41. IMPORTANT:  All routines (Bank, Init, and Exit) must end with 'retf'
  42. (far return).  You may use the memory from [cs:0] up to [cs:0ffh] for
  43. variables.  If you need more memory, you can reserve some using DB,
  44. DW etc.  Note: you must initialize the memory!  It is NOT allowed to
  45. use 'DB ?' or 'DW ?'!  Don't use the data segment, the contents of DS
  46. are undefined and must not be changed.  Example:
  47.         Tmp     dw      0,1,2,3
  48.                 ...
  49.                 mov     ax,cs:[Tmp]
  50.  
  51. The Init part is called after QPEG has switched into graphics mode.
  52. The values for AX and BX which were used to switch to the current mode
  53. are given in AX and BX, respectively.
  54. In CX the number of bytes per line is stored.  You may modify it if
  55. necessary.  If you don't want to modify it, you must save CX on the stack
  56. if you're using it for other porposes.  The default value for CX is
  57. taken from the CFG file; it's usually calculated like this:
  58.     16 color modes:  width/8 (for a single plane)
  59.    256 color modes:  width
  60.    32K color modes:  width*2
  61.    16M color modes:  width*3
  62. This routine may modify any registers without saving them, exept CS, DS,
  63. SS, SP, BP and CX (see above).  Most cards don't need an initialization
  64. (because it is done by the BIOS at the mode switch), in this case 'retf'
  65. is the only instruction.
  66.  
  67. The Exit part is called when the mode is not needed anymore, i.e. before
  68. switching to another mode, or before switching back to text mode.
  69. You must save CS, DS, SS, SP and BP if they're modified.
  70. Again, most cards don't need any exit code, so there's usually only a
  71. 'retf'.
  72.  
  73. The Bank part is called every time a bank switch is necessary.
  74. The bank number is given in AL.  The routine may modify AL and DX without
  75. saving them.  If other registers are used, they must be saved on the
  76. stack.
  77. The bank switching routine needn't be very fast, since it's called only
  78. when it's really necessary (not very often).
  79.  
  80. To make the driver file:
  81.    TASM /M XXXX.ASM
  82.    TLINK /T XXXX.OBJ
  83.    REN XXXX.COM XXXX.DRV
  84. Then copy the driver file to the directory which holds QPEG.EXE.
  85. Finally you have to write a config file.  It's best to copy one of the
  86. other config files and make the necessary changes.  The first line
  87. should go like 'XXXX BGR' or 'XXXX RGB'.
  88.  
  89. For more information on the configuration files, please read CFG.DOC.
  90.